const key = 'accessToken';
/**
 * 获取Token
 */
export function getToken() {
    return localStorage.getItem(key) || '';
}

/**
 * 设置Token
 */
export function setToken(token) {
    localStorage.setItem(key, token);
}

/**
 * 清除Token
 */
export function clearToken() {
    localStorage.removeItem(key);
}

/**
 * 解析Token
 */
export function parseToken(token) {
    const strings = token.split('.');
    return JSON.parse(decodeURIComponent(escape(window.atob(strings[1].replace(/-/g, "+").replace(/_/g, "/")))));
}